
data = [
    ['Alice', 25,],
    ['New York',100],
    ['Bob', 30],
    ['Chicago',56],
    ['Charlie', 20],
    ['Boston',30]
]

# 原地按年龄排序
data.sort(key=lambda x: x[1],reverse=True)

rank = 1
data[0].append(rank)
for index in range(1,len(data)):
    if data[index][1] ==data[index-1][1]:
        data[index].append(rank)
    else:
        rank +=1
        data[index].append(rank)

for item in data:
    print(item)